package cn.edu.scau.nursingcenter.dao;

import java.util.List;
import java.util.Optional;

import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import cn.edu.scau.nursingcenter.entiry.Bed_information;

/**
 * 床位信息管理DAO接口Bed_informationRepository
 * @author feng
 *
 */
@Repository
public interface Bed_informationRepository extends JpaRepository<Bed_information, Integer>{

	/**
	 * 根据客户名字查询
	 * @param name客户名字
	 * @return list
	 */
	@Query(value = "from bed_information b where b.c_name = ?1")
	List<Bed_information> findByName(@Param("c_name")String name);
	
	/**
	 * 根据客户编号查询
	 * @param cid 客户编号
	 * @return optional
	 */
	@Query(value = "from bed_information b where b.c_id = ?1")
	Optional<Bed_information> findByCid(@Param("c_id")Integer cid);
}
